﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>欢迎登录后台管理系统</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="js/jquery.js"></script>
<script src="js/cloud.js" type="text/javascript"></script>
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>

<script language="javascript">
	$(function(){
    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
	$(window).resize(function(){
    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
    })
});
    //商家注册
    function subReg() {
        let account = document.getElementById("inputAccount").value;
        let password = document.getElementById("inputPassword").value;
        let passwordConf = document.getElementById("inputPasswordConf").value;
        let obj = {mname: account, mpassword: password};
        if (account === "" || password === "" || passwordConf === "") {
            // alert("账号或密码不能为空");
            document.getElementById("reg-info").innerHTML = "账号或密码不能为空";
            return;
        } else  {
            // alert("两次的密码不一致");
            document.getElementById("reg-info").innerHTML = "";
            if (password !== passwordConf) {
                document.getElementById("reg-info").innerHTML = "两次的密码不一致";
                return;
            } else {
                document.getElementById("reg-info").innerHTML = "";
                $.ajax({
                    url: 'merchant/add',
                    type: "POST",
                    dataType: 'JSON',
                    contentType: 'application/json',
                    data:JSON.stringify(obj),
                    success: function (res) {
                        // console.log('res',res)
                        if (res.code == 200) {
                            alert("注册成功");
                            return;
                        } else {
                            alert(res.message);
                        }
                    },
                    complete: function (res) {
                        console.log('res',res)
                    },
                })
            }
        }
    }
</script>

</head>

<body style="background-color:#1c77ac; background-image:url(images/light.png); background-repeat:no-repeat; background-position:center top; overflow:hidden;">



<div id="mainBody">
    <div id="cloud1" class="cloud"></div>
    <div id="cloud2" class="cloud"></div>
</div>


<div class="logintop">
    <span>欢迎登录后台管理界面平台</span>
    <ul>
    <li><a href="#">回首页</a></li>
    <li><a href="#">帮助</a></li>
    <li><a href="#">关于</a></li>
    </ul>
</div>

    <div class="loginbody">

    <span class="systemlogo"></span>

    <div class="loginbox">

    <ul>
    <li><input name="" type="text" class="loginuser" value="admin" onclick="JavaScript:this.value=''"/></li>
    <li><input name="" type="text" class="loginpwd" value="密码" onclick="JavaScript:this.value=''"/></li>
    <li>
        <input name="" type="button" class="loginbtn" value="登录"  onclick="javascript:window.location='main.html'"  />
        <button type="button" class="loginbtn">商家注册</button>
    </li>
    </ul>


    </div>

    </div>

<div class="loginbm">版权所有  2013  <a href="http://www.uimaker.com">uimaker.com</a>  仅供学习交流，勿用于任何商业用途</div>
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">商家注册入口</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <div class="form-group">
                            <label for="inputAccount" class="col-sm-2 control-label">账号</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="inputAccount" placeholder="请输入您的账号">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputPassword" class="col-sm-2 control-label">密码</label>
                            <div class="col-sm-10">
                                <input type="password" class="form-control" id="inputPassword" placeholder="请输入您的密码">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputPasswordConf" class="col-sm-2 control-label">确认密码</label>
                            <div class="col-sm-10">
                                <input type="password" class="form-control" id="inputPasswordConf" placeholder="请确认您的密码">
                            </div>
                        </div>
                    </form>
                    <span id="reg-info" style="color: red"></span>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" onclick="subReg()">提交</button>
                </div>
            </div>
        </div>
    </div>
</body>

</html>
